<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>应收账款查询</title>
<script src="../public/libs/vue.js"></script>
<!--引入element组件库-->
<script src="../public/plugins/element-ui/lib/index.js"></script>
<script src="../public/libs/jquery.min.js"></script>
<script src="../public/plugins/axios/dist/axios.js"></script>
<script src="../public/libs/JsonExportExcel.min.js"></script>
<!-- 引入element样式 -->
<link rel="stylesheet" href="../public/plugins/element-ui/lib/theme-chalk/index.css">
</head>
<body style="overflow: scroll; overflow-x: hidden;">
	<div id="myVue" align="center">
		<div style="overflow: auto; width: 100%;">
			<el-row> 
				<el-col :span=3 align="right"> <span>报价单号：</span> </el-col> 
				<el-col :span=4> 
					<el-input type="input" size="mini" v-model="quotationNo"></el-input> 
				</el-col> 
				<el-col :span=3	align="right"> 			
					<span>客户名称：</span> </el-col> 
					<el-col :span=4> <el-input type="input"
				size="mini" v-model="cardName"></el-input> </el-col> 
				<el-col :span=10> 
					<el-button size="mini" type="info" icon="el-icon-search" @click="queryList">查询报价单</el-button> 
					<el-button size="mini" type="primary" icon="el-icon-top-right" @click="jsonToExcel">导出 EXCEL</el-button>
				</el-col> 
			</el-row>
		</div>
		<p></p>
		<el-row> 
			<el-col :span=24> 
				<el-table
				:data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)" @sort-change='sort_change'
				size="mini" border :show-header="true"
				:header-cell-style="{'text-align':'center','font-size':'14px',background:'#eef1f6',color:'#000000'}"
				ref="tableLine" style="background-color: bisque;width:100%;"> 
					<el-table-column label="ID" prop="id" width="50" sortable="custom">
					</el-table-column>
					<el-table-column v-for="(col,index) in titleData" :label="col.propName" 
					:prop="col.prop" :key="index" sortable="custom" :width="110" >
					</el-table-column> 				
			
					<el-table-column label="操作"	style="width:120 ;" align="center"> 
						<template slot-scope="rowData">
							<el-button	size="mini" type="info" icon="el-icon-document" @click="popWin('head',rowData.row)">表头</el-button> 
							<el-button	size="mini" type="success" icon="el-icon-truck"  @click="popWin('prod',rowData.row)">产品</el-button> 
							<el-button	size="mini" type="primary"  icon="el-icon-paperclip" @click="popWin('attach',rowData.row)">附件</el-button> 
							<el-button	size="mini" type="warning" icon="el-icon-top"  @click="popWin('export',rowData.row)">导出</el-button>
						</template> 
					</el-table-columm>					
				</el-table> 
				<el-pagination
				@size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
				:page-sizes="[10, 20, 30, 50]" :page-size="pageSize"
				layout="total, sizes, prev, pager, next, jumper" :total="tableData.length"> 
				</el-pagination> 
			</el-col> 
		</el-row>
		<div
			style="width: 100%; height: 200px; background: url(../img/loading7.gif) no-repeat; 
				background-size: 150px 150px; position: relative; top: 50%; left: 45%;"
			v-show="dataLoading">
		</div>
			
		<!-- 修改基本信息head对话框 -->
		<el-dialog title="修改基本信息:" :visible.sync="headWin" width="1000px" append-to-body> 
			<el-form	:inline="true" name="headWin" style="background-color:#87CEEB" 
			:model="{headWinData}" 				ref="head">
				<el-row class="myMargin"> 
					<el-col :span=8> 
						<el-form-item label="客户编码:"	prop="cardCode"> 
						<el-input v-model="headWinData.cardCode" size="mini">客户编码</el-input>
						</el-form-item> 
					</el-col> 
					<el-col :span=8> <el-form-item label="客户名称:" prop="cardName"> 
							<el-input	v-model="headWinData.cardName" size="mini" placeholder="客户名称"></el-input>
						</el-form-item> </el-col> 
					<el-col :span=8><el-form-item label="交货地点:" prop="delivery"> 
						<el-input v-model="headWinData.delivery" size="mini" placeholder="交货地点"></el-input> 
					</el-form-item> </el-col> 
					
				</el-row> 
				<el-row class="myMargin"> 
					<el-col :span=8> <el-form-item label="项目主题:" prop="qtnTopic"> 
						<el-input v-model="headWinData.qtnTopic" size="mini" placeholder="项目主题"></el-input> 
					</el-form-item> </el-col> 
					<el-col :span=8> <el-form-item label="询价类型:" prop="qtnType"> 
						<el-select v-model="headWinData.qtnType" placeholder="询价类型" size="mini">       
							<el-option label="甲板" value="甲板"></el-option>                 
							<el-option label="渔具" value="渔具"></el-option>   
							<el-option label="全船" value="全船"></el-option>
							<el-option label="其他" value="其他"></el-option>       
						</el-select> 
					</el-form-item> </el-col> 
					<el-col :span=8> <el-form-item label="交易类型:" prop="tradeType"> 
						<el-select v-model="headWinData.tradeType" placeholder="交易类型" size="mini">       
							<el-option label="内贸自制" value="内贸自制"></el-option>
			                <el-option label="外贸自制" value="外贸自制"></el-option>   
							<el-option label="国内贸易" value="国内贸易"></el-option>                 
							<el-option label="出口贸易" value="出口贸易"></el-option>   
							<el-option label="进口贸易" value="进口贸易"></el-option>                 <el-option label="转口贸易" value="转口贸易"></el-option>
			            </el-select> 
					</el-form-item> </el-col> 
				</el-row> 
				<el-row class="myMargin">
					<el-col :span=8> <el-form-item label="合同编号:" prop="contractNo"> 
						<el-input v-model="headWinData.contractNo" size="mini" placeholder="合同编号"></el-input> 
					</el-form-item> </el-col> 
					<el-col :span=8> <el-form-item label="合同金额:" prop="contractAmt"> 
						<el-input v-model="headWinData.contractAmt" size="mini" placeholder="合同金额"></el-input> 
					</el-form-item> </el-col> 
					<el-col :span=8> <el-form-item label="签订时间:" prop="contractTime"> 
						<el-date-picker    v-model="headWinData.contractTime" type="date"
						 placeholder="选择日期" size="mini"> </el-date-picker>
					</el-form-item> </el-col> 	
								
				</el-row>
				<el-row> 
					<el-col :span=24 class="myMargin"> <el-form-item label="内部备注:"prop="inMemo"> 
						<el-input type="textarea" :rows="2" v-model="headWinData.inMemo" size=mini 
							placeholder="请输入备注内容" style="width:800px;"></el-input> 
					</el-form-item> </el-col> 
				</el-row> 
				<el-row> 
					<el-col :span=24 class="myMargin"> <el-form-item label="外部备注:"prop="outMemo"> 
						<el-input type="textarea" :rows="2" v-model="headWinData.outMemo" size=mini 
							placeholder="请输入备注内容" style="width:800px;"></el-input> 
					</el-form-item> </el-col> 
				</el-row> 
				<el-row class="myMargin"> 
					<el-col :span=4> 
						<span >项目ID：{{headWinData.id}}</span>
					</el-col>
					<el-col :span=5> 
						<span >项目编号：{{headWinData.quotationNo}}</span>
					 </el-col>
					<el-col :span=5> 
						<span v-if="headWinData.status == 0">项目状态：尚未登记</span> 
						<span v-if="headWinData.status == 1">项目状态：完成正常登记</span>
						<span v-if="headWinData.status == 2">项目状态：完成技术核算</span> 
						<span v-if="headWinData.status == 3">项目状态：完成财务核算</span>
						<span v-if="headWinData.status == 4">项目状态：完成打单</span> 
						<span v-if="headWinData.status == 5">项目状态：完成打印</span>
						<span v-if="headWinData.status == 6">项目状态：作废</span>
					</el-col> 
					<el-col :span=5> 
						<span >业务人员:{{headWinData.trueName}}</span>
					</el-col> 
					
					<el-col :span=5> 
						<span style="color: red;">报价总额:{{total}}</span>
					</el-col> 
					
				</el-row> 
				
				
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button type="primary" size="mini" @click="updateHead">更新</el-button>
				<el-button  type="primary" size="mini"  @click="closeWin('head')">取 消</el-button>
			</div>
		</el-dialog>
		<!-- 修改产品信息prod对话框 -->
		<el-dialog title="修改产品信息" :visible.sync="prodWin" width="1200px" append-to-body> 
			<!--产品列表-->
		<el-table :data="prodLines"	size="mini"  :header-cell-style="{'text-align':'center',background:'#eef1f6',color:'#0000FF'}"
			ref="prodLines"  border style="background-color: bisque;">                
			<el-table-column label="ID" prop="id" width=60>
				</el-table-column>
				<el-table-column prop="quotationID" label="报价ID" width=60>					
				</el-table-column>
				<el-table-column prop="productName" label="初步名称">
				</el-table-column>
				<el-table-column prop="confirmName" label="确定名称">
					<template slot-scope="scope">
      					<el-input size="mini" v-model="scope.row.confirmName" ></el-input>
    				</template>
				</el-table-column>
				<!--<el-table-column prop="productCode" label="产品编码">
					<template slot-scope="scope">
      					<el-input size="mini" v-model="scope.row.productCode" ></el-input>
    				</template>
				</el-table-column>-->
				
				<el-table-column prop="specification" label="规格">
					<template slot-scope="scope">
      					<el-input size="mini" v-model="scope.row.specification"></el-input>
    				</template>
				</el-table-column>
				<el-table-column prop="unit" label="单位">
					<template slot-scope="scope">
      					<el-input size="mini" v-model="scope.row.unit" ></el-input>
    				</template>
				</el-table-column>
				<el-table-column prop="quantity" label="数量">
					<template slot-scope="scope">
      					<el-input size="mini" v-model="scope.row.quantity" ></el-input>
    				</template>
				</el-table-column>
				<el-table-column label="操作"	style="width:100 ;" align="center"> 
					<template slot-scope="rowData">
						<el-button	size="mini" type="primary" @click="updateRow('prod',rowData.row)">更新</el-button> 
						<el-button	size="mini" type="primary" @click="delRow('prod',rowData.row)">删除</el-button> 
					</template> 
				</el-table-columm>
		</el-table> 
		<p></p>
		<!--新增产品-->
			<el-form :inline="true"  name="prodAdd" style="background-color:#87CEEB" 
				:model="prodAddData" ref="prodAdd">
				<el-row >
					<el-col :span=2 align="center"> <el-form-item label="" prop="id"> 
						<span>{{prodAddData.id}}</span>
					</el-form-item> </el-col> 	
					<el-col :span=2 align="center"> <el-form-item label="" prop="quotationID"> 
						<span>{{prodAddData.quotationID}}</span>	
					</el-form-item> </el-col> 
					<el-col :span=3> <el-form-item label="" prop="productName"> 
						<el-input v-model="prodAddData.productName" size="mini" placeholder="产品初名"></el-input>
					</el-form-item> </el-col>
					<el-col :span=3> <el-form-item label="" prop="confirmName" > 
						<el-input v-model="prodAddData.confirmName" size="mini" placeholder="确定名称"></el-input>
					</el-form-item> </el-col>
					<el-col :span=3> <el-form-item label="" prop="productCode" > 
						<el-input v-model="prodAddData.productCode" size="mini" placeholder="产品编码"></el-input>
					</el-form-item> </el-col>
					<el-col :span=3> <el-form-item label="" prop="specification"> 
						<el-input v-model="prodAddData.specification" size="mini" placeholder="规格型号"></el-input>
					</el-form-item> </el-col>
					<el-col :span=3> <el-form-item label="" prop="unit"> 
						<el-input v-model="prodAddData.unit" size="mini" placeholder="单位"></el-input>
					</el-form-item> </el-col>
					<el-col :span=3> <el-form-item label="" prop="quantity"> 
						<el-input v-model="prodAddData.quantity" size="mini" placeholder="数量"></el-input>
					</el-form-item> </el-col>	
					<el-col  :span=2 align="center"> <el-form-item label="" > 
						<el-button size="mini" type="primary" @click="saveProd">新增产品</el-button>
					</el-form-item> </el-col>	
				</el-row>
			</el-form> 
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" size="mini" @click="closeWin('prod')">确 定</el-button>
				<el-button type="primary" size="mini"  @click="closeWin('prod')">取 消</el-button>
			</div>
		</el-dialog>

		
		<!--上传附件-->
	<el-dialog title="附件管理" width="1000px"  :visible.sync="attachWin" ref="eDialog" append-to-body>
		<el-row>
			<el-col>
				<el-table :data="attachLines" @sort-change='sort_change'
					size="mini" border :show-header="true"
					:header-cell-style="{'text-align':'center','font-size':'14px',background:'#eef1f6',color:'#000000'}"
					ref="prodWin" style="background-color: bisque;width:100%;"> 
					<el-table-column label="ID" prop="id" width="70" >
					</el-table-column>
					<el-table-column prop="quotationID" label="报价ID" width="70">					
					</el-table-column>
					<el-table-column prop="fileName" label="文件名称" width="300">
					</el-table-column>
					<el-table-column prop="transTime" label="上传时间" width="200">		
					</el-table-column>				
					<el-table-column prop="trueName" label="上传用户" width="100">
					</el-table-column>			
					
					<el-table-column label="操作"	style="width:100 ;" align="center"> 
						<template slot-scope="rowData">
							<el-button	size="mini" type="primary" @click="downLoadRow(rowData.row)">下载</el-button> 							
						</template> 
					</el-table-columm>				
				</el-table> 
			</el-col>
		</el-row>
		<el-row>
			<el-col ::span="22">
				<el-upload class="upload-demo" ref="upload" action="" :accept="acceptFileType"
					:limit=5 :on-exceed="handleExceed" :before-upload="beforeUpload"
					:on-preview="handlePreview" :on-remove="handleRemove"
					:file-list="fileList" :auto-upload="false">
					<el-button slot="trigger" size="small" type="primary">请选取上传的附件</el-button>
					<div slot="tip" class="el-upload_tip">文件名请用中英文,且不超过10M</div>
				</el-upload>
			</el-col>
		</el-row>
		
		<span slot="footer" class="dialog-footer">
			<el-button @click="submitUpload" type="primary" size="mini" :loading="uploadLoading" > 确定上传</el-button>
			<el-button @click="closeWin('attach')" type="primary" size="mini">取消</el-button>
		</span>
	</el-dialog>
	</div>

	<script>

	var vm=new Vue({
	el: '#myVue',
	data: {			
			dataLoading:false,
	       	tableData: [],
	       	headWinData:{id:"",cardCode: "",cardName:"",deliver:"",
				qtnType:"",tradeType:"",projectTopic:"",
		      	quotationNo:"",department:"",status:0,remark:""},
			prodLines:[{id:"",quotationID:"",productName:"",confirmName:"",
				productCode:"",specification:"",unit:"",quantity:0}],
			prodAddData:{id:0,quotationID:0,productName:"",confirmName:"",
				productCode:"",specification:"",unit:"",quantity:0},
			attachLines:[{id:"",quotationID:"",fileName:"",transTime:"",
				url:"",userName:"",trueName:""}],
			tableHead: {quotationNo:"",qtnTopic:"",cardCode:"",cardName:"",
				delivery:"",qtnType:"",tradeType:"",userName:"",trueName:"",
			   department:"",createTime:"",timeRequire:"",
			   inMemo:"",outMemo:"",total:0,contractNo:"",contractAmt:"",status:0,id:0,contractTime:""},
		 	titleData:[{"prop":"quotationNo","propName":"编码"},{"prop":"qtnTopic","propName":"主题"},
		 	{"prop":"qtnType","propName":"报价类型"},{"prop":"cardName","propName":"客户名称"},
			 {"prop":"trueName","propName":"报价人员"},{"prop":"createTime","propName":"报价时间"}],		 
		 	quotationNo:"",//LIST查询条件1
		 	cardName:"",//LIST查询条件2
            currentPage: 1,// 当前页            
            pageSize: 10,// 每页多少条
            proptype: "", //存放column.prop的字符串值
			headWin:false,prodWin:false,attachWin:false,rowQtnNo:"",rowQtnID:0,
			uploadTemplateDialog:false,
           	fileList:[],
           	uploadLoading:false,
           	acceptFileType: '*.*',//'.xls,.xlsx',
           	downLoadLoading:'',
			fType:'',
			total:0
			          },
	methods: {
		 // 每页多少条
        handleSizeChange:function(val) {
            this.pageSize = val;
        },
        // 当前页
        handleCurrentChange:function(val) {
            this.currentPage = val;
        },
		widthSet:function(prop){
			if(prop=="id") return 0; else return 110;
		},
		queryList:function(){
			var that=this;
			this.tableData=[]; 
			//let fd=new FormData();
            //fd.append('quotationNo',this.quotationNo);
			//fd.append('cardName',this.cardName);
			dataLoading=true;
			axios({
                method:'post',
                url:'../erp/quotation/list',
                data:{quotationNo:this.quotationNo,cardName:this.cardName},
                //headers:{"Content-Type":"multipart/form-data"}
            }).then(rsp=>{               
                var resp=rsp.data;                 
                that.tableData=resp.tableData; 
				//alert(JSON.stringify(resp.tableData));
                if(resp.code==200){   
					that.dataLoading=false;					
                }else{
                    that.$message({
                        type:'error',
                        showClose:true,
                        duration:60000,
                        message:"哦豁，数据获取失败！"
                    });
                }
            }).catch(error=> {
                       
                that.$message({
                    type:'error',
                    duration:60000,
                    message:'请求失败! error:'+error
                });
            })
			 
		},

		popWin:function(which,row){
			rowQtnNo=row.quotationNo;
			rowQtnID=row.id;
			switch(which){
			case "head":
				var that=this;
				this.headWinData=[]; 
				axios({
					method:'post',
					url:'../erp/quotation/head/queryID',
					data:{id:row.id},
				}).then(rsp=>{               
					var resp=rsp.data;                 
					that.headWinData=resp.headWinData;  
					that.total=resp.total;
					//alert(JSON.stringify(that.headWinData));    
					if(resp.code==200){ that.headWin=true; }
					else{ }
				}).catch(error=> {
				});
				break;
			case "prod":
				
				var that=this;
				that.prodLines=[]; 
				that.prodAddData.quotationID=row.id;
				that.prodAddData.id=0;
				//alert(JSON.stringify(that.prodAddData));
				axios({
					method:'post',
					url:'../erp/quotation/product/list',
					data:{quotationID:row.id,all:1},
				}).then(rsp=>{               
					var resp=rsp.data;                 
					that.prodLines=resp.prodLines;     
					if(resp.code==200){ that.prodWin=true; }
					else{ }
				}).catch(error=> {
				});
				break;
			case "attach" :
				var that=this;
				this.attachLines=[]; 
				axios({
					method:'post',
					url:'../erp/quotation/attach/list',
					data:{quotationID:row.id},
				}).then(rsp=>{               
					var resp=rsp.data;                 
					that.attachLines=resp.attachLines;     
					if(resp.code==200){ that.attachWin=true; }
					else{ }
				}).catch(error=> {
				});
				break;
			case "export" :
				var that=this;
				axios({
					method:'post',
					url:'../erp/quotation/export',
					data:{quotationID:row.id},
					responseType: 'blob'
				}).then(rsp=>{               
					let url = window.URL.createObjectURL(new Blob([rsp.data])); //转换为可用URl地址
				let link = document.createElement("a"); //创建a标签
				link.style.display = "none"; //使之不可见
				link.href = url; //赋URL地址
				link.setAttribute("download","temp.xlsx" ); //设置下载属性、以及文件名
				document.body.appendChild(link); //将a标签插至页面中
				link.click(); //强制触发a标签事件
				URL.revokeObjectURL(link.href); // 释放URL 对象
				document.body.removeChild(link);
				}).catch(error=> {
				});
				break;
			default:break;
			}
		},
		closeWin:function(which){
			switch(which){
			case "head":this.headWin=false;break;
			case "prod":this.prodWin=false;break;
			case "attach":this.attachWin=false;break;
			default:break;
			}
		},
		updateRow:function(which,row){
			var r=row;
			
			switch(which){
			case "prod":
				
				var that=this;
				axios({
					method:'post',
					url:'../erp/quotation/product/update',
					data:r
				// headers:{"Content-Type":"multipart/form-data"}
				}).then(rsp=>{
				    
					let resp=rsp.data;
					if(resp.code==200){
						alert("产品信息已更新！");
						that.prodLines=resp.prodLines;		                     
					}
				}).catch(error=> {     })
				return false;
				break;
			default:break;
			}

		},
		delRow:function(which,row){
			switch(which){
			case "prod":
				if(!confirm("确实要删除本行产品信息？")) return false;
				var that=this;
				axios({
					method:'post',
					url:'../erp/quotation/product/delete',
					data:{productID:row.id,quotationID:row.quotationID}
				// headers:{"Content-Type":"multipart/form-data"}
				}).then(rsp=>{
				
					let resp=rsp.data;
					if(resp.code==200){
						that.prodLines=resp.prodLines;		                     
					}
				}).catch(error=> {     })
				return false;
				break;
			default:break;
			}

		},
		saveProd:function(){
			if(this.prodAddData.quotationID==0) return false;
			if(this.prodAddData.confirmName=="") return false;
			if(this.prodAddData.quantity===0) return false;
            var that=this;
            axios({
                method:'post',
                url:'../erp/quotation/product/save',
                data:this.prodAddData
               // headers:{"Content-Type":"multipart/form-data"}
            }).then(rsp=>{
              
                let resp=rsp.data;
                if(resp.code=="200"){
					that.prodLines=resp.prodLines;		                     
                }
            }).catch(error=> {     })
            return false;
		},
		downLoadRow:function(row){
			
			axios({ 
				method: 'post',
				url: '../erp/quotation/attach/download', // 请求地址
				data: {url:row.url,fileName:row.fileName}, // 参数
				responseType: 'blob' //  表明返回服务器返回的数据类型  这里注意要加上responseType
			})
			.then((res) => { // 处理返回的文件流
				
				let url = window.URL.createObjectURL(new Blob([res.data])); //转换为可用URl地址
				let link = document.createElement("a"); //创建a标签
				link.style.display = "none"; //使之不可见
				link.href = url; //赋URL地址
				link.setAttribute("download", row.fileName); //设置下载属性、以及文件名
				document.body.appendChild(link); //将a标签插至页面中
				link.click(); //强制触发a标签事件
				URL.revokeObjectURL(link.href); // 释放URL 对象
				document.body.removeChild(link);
			})
		
		},
		uploadFile:function(event){
			if(tableHead.id=="" || tableHead.id==0) return;
			//var el = event.currentTarget;
            this.uploadLoading=false;
           
            var that=this;
            this.fileList=[];                
            this.uploadTemplateDialog=true;  
            
            setTimeout(function(){
                that.$refs.upload.clearFiles();
               // that.$refs.eDialog.title=el.name;
            },100);
        },
        handleExceed:function(files,fileList){
            this.$message.warning(' 最多选择1个文件!');
        },
        submitUpload:function(){
            this.uploadLoading=true;
            var that=this;
            setTimeout(function () {
                if(that.$refs.upload.$children[0].fileList.length<=5){
                    that.$refs.upload.submit();
                }else{
                    that.uploadLoading=false;
                    that.$message({
                        type:'error',
                        showClose:true,
                        duration:3000,
                        message:'请选择文件!'
                    });
                };
            },100);
        },
        handleRemove:function(file,fileList){
            //console.log(file,fileList);
        },
        handlePreview:function(file){
            //console.log(file);
        },
        beforeUpload:function(file){
            var that=this;
            //文件类型
            var fileExtName=file.name.substring(file.name.lastIndexOf('.')+1);
            var fileSize=file.size;
           // console.log('fileName:'+fileExtName);
            if(fileSize>10485760){
                that.uploadTemplateDialog=false;
                that.$message({
                    type:'error',
                    showClose:true,
                    duration:3000,
                    message:'文件不能大于10M!'
                });
                return false;
			}
			
            that.downloadLoading=that.$loading({
                lock:false,
                text:'数据上传中...',
                spinner:'el-icon-loading',
                background:'rgba(0,0,0,0.7)'
            });
            let fd=new FormData();
            fd.append('file',file);           
			
			fd.append("quotationNo",rowQtnNo);
			fd.append("quotationID",rowQtnID);
		
            axios({
                method:'post',
                url:'../erp/quotation/attach/upload',
                data:fd,
                headers:{"Content-Type":"multipart/form-data"}
            }).then(rsp=>{
				that.downloadLoading.close();
				
                that.uploadLoading=false;
                let resp=rsp.data
                if(resp.code==2){
					that.uploadTemplateDialog=false;
					that.attachLines=resp.attachLines;
                    //that.$message.success(resp.retMsg);
                    that.$message({
                        type:'success',
                        showClose:true,
                        duration:60000,
                        message:resp.record>0 ?"附件已成功上传并录入数据库!":"上传成功，写入数据库失败！"
                    });
                    
                }else{
                    that.uploadTemplateDialog=false;
                    that.$message({
                        type:'error',
                        showClose:true,
                        duration:60000,
                        message:"附件上传失败！"
                    });
                }
            }).catch(error=> {
                that.downloadLoading.close();
                that.uploadLoading=false;
                that.uploadTemplateDialog=false;
                that.$message({
                    type:'error',
                    showClose:true,
                    duration:60000,
                    message:'请求失败! error:'+error
                });
            })
            return false;
        },
		submitProd(){},submitAttach(){},
		updateHead:function(){
			var that=this;
            axios({
                method:'post',
                url:'../erp/quotation/head/update',
                data:this.headWinData
               // headers:{"Content-Type":"multipart/form-data"}
            }).then(rsp=>{
                
                let resp=rsp.data;
                if(resp.code==200){
					alert("完成表头更新");                     
				}
				else alert("更新失败！");
            }).catch(error=> {     })
		},
		//若采用相同排序方法可简写：
	    sort_change:function(column) {
			this.currentPage = 1; // 排序后返回第一页
		    this.proptype = column.prop; // 将键名prop赋值给变量proptype
	      if (column.order === "descending") {
	        this.tableData.sort(this.my_desc_sort);
	       
	      } else if (column.order === "ascending") {
	        this.tableData.sort(this.my_asc_sort);	        
	      }
	      
	    },
	    //排序方法
	    my_desc_sort:function(a, b) {
	    	if(typeof(a[this.proptype])=="string")
	    		 return  b[this.proptype].localeCompare(a[this.proptype]);
	    	else if(typeof(a[this.proptype])=="number")
	      	return b[this.proptype] - a[this.proptype]; // a["time"] 等价于 a.time
	    },
	    my_asc_sort:function(a, b) {
	    	if(typeof(a[this.proptype])=="string")
	    		 return  a[this.proptype].localeCompare(b[this.proptype]);
	    	else if(typeof(a[this.proptype])=="number")
	      	return a[this.proptype] - b[this.proptype]; // a["time"] 等价于 a.time
	    },
	    jsonToExcel:function(){
	    	var arr = [];
	    	var datas=[];
	    	this.titleData.forEach(function(item){
	    	 //arr.push({id: item.dd,	 text: item.re1})
	    	  arr.push(item.propName) ;
	    	})
			var option={};
			option.fileName = "应收账款查询"+new Date().getFullYear();
			
			datas.push({sheetData:this.tableData,sheetHeader:arr});
			option.datas=datas;
			
			var toExcel=new ExportJsonExcel(option);
			toExcel.saveExcel();
		}
	}
})

</script>
<style lang="less" scoped>
.el-tabs__item {
	padding: 0 20px;
	height: 40px;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	line-height: 40px;
	display: inline-block;
	list-style: none;
	font-size: 18px;
	font-weight: 500;
	color: #FFA500;
	position: relative;
}

.el-tabs__content {
	height: calc(100% - 40px);
}

.el-tabs--card>.el-tabs__header {
	border-bottom: 1px solid #E4E7ED;
	background-color: gainsboro;
}

.el-tabs__item.is-active {
	color: #00BFFF;
}

.el-tabs__item:hover {
	color: #00BFFF;
	cursor: pointer;
}

.myMargin {
	margin-left: 5%;
}
</style>
</body>
</html>